Practical Smart Device Design and Construction by Christopher Harrold

Practical Smart Device Design and Construction by Christopher Harrold

Author:Christopher Harrold
Language: eng
Format: epub
ISBN: 9781484256145
Publisher: Apress


Analog

Like a digital sensor, an analog sensor also uses a change in voltage to indicate a change in condition. Unlike a digital signal, however, there is much more granularity, and interpretation of the signal is required to understand the output. Generally, the analog signal is a percentage of the maximum voltage, divided into slices. Those slices can be from 0 to 255, 0 to 1023, or whatever the sensor/device is programmed for and is generally published in the usage guidance for the sensor itself. What this means in practical terms is that an analog pin can send and receive fractions of the total voltage to the MCU, which in turn can allow for more fine-grained control over the attached device. Also, analog sensors are generally outputting readings all the time (with some exceptions for sensors that require a start/stop signal), which means that in order to collect those readings you might need to check the readings from the sensor a lot to get the level of fidelity you want. Figure 8-6 shows an example of an analog capable sensor.

I have purposely chosen two sensors that do the same basic function – sensing sound. In this case, the analog sensor would potentially offer a much higher level of fidelity to my application, as the presence of an analog sensor indicates that it could output more data. In this case, spoiler alert, it does, allowing me to get a sense of the actual sound level as a fraction of the maximum level (in this case a value somewhere between 0 and 1023 slices of the voltage). This could allow additional functionality in my software, at the cost of additional computation for me to do in code. This is an important consideration for your own devices. If you just need to know that something is or isn’t, then programmatically speaking a digital “yes or no” is oftentimes enough to accomplish the purpose.

As an input source to your MCU, this is used for sensors that are detecting the range of a condition. Light sensors, moisture sensors, humidity sensors, and many others use the returned voltage as a means of reflecting the amount of something detected. Generally (but not always), the higher the voltage, the more of whatever the sensor detects is detected. It falls on you to utilize the sensor documentation to determine what the value means, and to provide the associated logic in the software to interpret the voltage result.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.